package cn.com.czpb.client.module.news.view;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import cn.com.czpb.client.R;
import cn.com.czpb.client.model.news.HighRiseBean;
import cn.com.czpb.client.utils.TUtils;

/**
 * Created by 猪猪侠 on 2017/7/25.
 */

public class TopViewHighrise implements View.OnClickListener {
    private View rootView;
    private Activity mActivity;
    private ImageView img_head_id;
    private TextView tv_name;
    private TextView tv_position;
    private TextView tv_content;

    public static TopViewHighrise instance(Activity activity){

        return new TopViewHighrise(activity);
    }

    public TopViewHighrise(Activity activity){
        //
        this.mActivity = activity;
        initView(activity);
    }

    public View getView(){
        return rootView;
    }
    /**
     * @param context
     */
    private void initView(Activity context) {
        LayoutInflater layoutInflater = LayoutInflater.from(context);
        rootView = layoutInflater.inflate(R.layout.view_highrisedetail,null);
        img_head_id = rootView.findViewById(R.id.img_head_id);
        tv_name = rootView.findViewById(R.id.tv_name);
        tv_position = rootView.findViewById(R.id.tv_position);
        tv_content = rootView.findViewById(R.id.tv_content);
    }

    public void setData(HighRiseBean bean){
        Glide.with(mActivity).load(bean.getAvatarPath()).into(img_head_id);
        tv_name.setText(bean.getCname());
        tv_position.setText(bean.getPosition());
        tv_content.setText("\u3000\u3000"+bean.getContent());
    }
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.ll_id_1://高层
                TUtils.toast("公交");
                break;
            case R.id.ll_id_2://政务
                TUtils.toast("高速公路");
                break;
            case R.id.ll_id_3://党务
                TUtils.toast("税务");
                break;
            case R.id.ll_id_4://服务
                TUtils.toast("社保");
                break;
        }
    }

}
